import { InstallParam } from '@/api/system/user/UserModel'
import { reactive } from 'vue'

export default function useBaseInstall() {
    const installModel = reactive<InstallParam>({
        baseURL: '',
        serverPort: '',
        mysqlAddr: '',
        mysqlDBName: '',
        mysqlUsername: '',
        mysqlPassword: '',
        redisAddr: '',
        redisPassword: ''
    })
    const installRules = reactive({
        baseURL: [
            { required: true, message: '请输入后台服务域名', trigger: 'blur' },
            {
                min: 3,
                max: 50,
                message: '长度在 3 到 50 个字符',
                trigger: 'blur'
            }
        ],
        serverPort: [
            { required: true, message: '请输入后台服务端口', trigger: 'blur' }
        ],
        mysqlAddr: [
            { required: true, message: '请输入后台数据库地址', trigger: 'blur' }
        ],
        mysqlDBName: [
            { required: true, message: '请输入后台数据库名称', trigger: 'blur' }
        ],
        mysqlUsername: [
            {
                required: true,
                message: '请输入后台数据库用户名',
                trigger: 'blur'
            }
        ],
        mysqlPassword: [
            { required: true, message: '请输入后台数据库密码', trigger: 'blur' }
        ],
        redisAddr: [
            { required: true, message: '请输入后台redis地址', trigger: 'blur' }
        ]
    })

    return {
        installModel,
        installRules
    }
}
